<html>
<head><meta charset="utf-8"><title>multiple template string arguments · project-inline-asm · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/index.html">project-inline-asm</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html">multiple template string arguments</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="200787383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200787383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200787383">(Jun 13 2020 at 21:54)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> I'd like to give this one a shot; I need some more experience with compiler internals. Mind if I try it?</p>



<a name="200790742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200790742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200790742">(Jun 13 2020 at 23:35)</a>:</h4>
<p>Sure, go ahead. Feel free to ask if you have any questions.</p>



<a name="200790856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200790856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200790856">(Jun 13 2020 at 23:38)</a>:</h4>
<p>Will do.</p>



<a name="200790860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200790860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200790860">(Jun 13 2020 at 23:38)</a>:</h4>
<p>Thanks!</p>



<a name="200791009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200791009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200791009">(Jun 13 2020 at 23:42)</a>:</h4>
<p>Currently finding that I need to go back and tweak config.toml, because the combination of <code>codegen-units = 0</code> and <code>parallel-compiler = true</code> means that compiling <code>rustc_middle</code> takes so much RAM it triggers the OOM killer.</p>



<a name="200791067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200791067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200791067">(Jun 13 2020 at 23:44)</a>:</h4>
<p>At the point the kernel killed it, the <code>rustc_middle</code> compilation had gotten to <code>3501452kB</code> of memory, including <code>2928204kB</code> of anonymous memory.</p>



<a name="200791286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200791286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200791286">(Jun 13 2020 at 23:51)</a>:</h4>
<p>...apparently turning off <code>parallel-compiler = true</code> didn't suffice. Hrm.</p>



<a name="200791663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200791663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200791663">(Jun 14 2020 at 00:03)</a>:</h4>
<p>...and neither did <code>codegen-units = 1</code>, so now I'm a little baffled.</p>



<a name="200797960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200797960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200797960">(Jun 14 2020 at 03:29)</a>:</h4>
<p>Disable debug info</p>



<a name="200797963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200797963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200797963">(Jun 14 2020 at 03:29)</a>:</h4>
<p>It uses a ton of memory when linking</p>



<a name="200800128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200800128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200800128">(Jun 14 2020 at 04:47)</a>:</h4>
<p>Wasn't an issue with linking as far as I can tell.</p>



<a name="200800166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200800166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200800166">(Jun 14 2020 at 04:48)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/73337">https://github.com/rust-lang/rust/issues/73337</a></p>



<a name="200800167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200800167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200800167">(Jun 14 2020 at 04:48)</a>:</h4>
<p>Worked around it for now I think.</p>



<a name="200806569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200806569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200806569">(Jun 14 2020 at 08:30)</a>:</h4>
<p>If <code>format!()</code> and friends doesn't support multiple strings, then why <code>asm!()</code> should?</p>



<a name="200828184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200828184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200828184">(Jun 14 2020 at 18:41)</a>:</h4>
<p>Because it's common, and semantically meaningful, to need multiple lines in asm, whereas <code>println!</code> can be broken into multiple lines.</p>



<a name="200828189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200828189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200828189">(Jun 14 2020 at 18:41)</a>:</h4>
<p>And because it's valuable for those individual lines to appear on individual source lines.</p>



<a name="200828190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200828190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200828190">(Jun 14 2020 at 18:41)</a>:</h4>
<p>And then for those lines to be formattable by <code>rustfmt</code>.</p>



<a name="200828261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200828261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200828261">(Jun 14 2020 at 18:43)</a>:</h4>
<p>Also, <code>format!</code> <em>can't</em> support multiple strings in the obvious way, because the second and subsequent strings could just as easily be format arguments.</p>



<a name="200828266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200828266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200828266">(Jun 14 2020 at 18:43)</a>:</h4>
<p>Whereas in <code>asm!</code> they can't be operands, because they don't start with <code>in</code> or <code>out</code> or <code>inout</code> or <code>options</code> or similar.</p>



<a name="200828311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200828311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200828311">(Jun 14 2020 at 18:44)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> Can I get a quick opinion on something?</p>



<a name="200828317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200828317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200828317">(Jun 14 2020 at 18:44)</a>:</h4>
<p>I was currently thinking "all template string arguments must come before all non-template arguments".</p>



<a name="200828349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200828349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200828349">(Jun 14 2020 at 18:45)</a>:</h4>
<p>I <em>could</em> see a case for relaxing that, which would make it easy to do things like <code>"instruction {}", in(reg) foo, "anotherinst {}", out(reg) bar</code>. But I personally think we should avoid that, at least initially. And it's not like people couldn't create a macro that allows it and then sorts all the template strings first.</p>



<a name="200828397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200828397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200828397">(Jun 14 2020 at 18:46)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> Would you agree that we should only allow multiple template strings <em>before</em> we see any other argument?</p>



<a name="200829457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200829457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200829457">(Jun 14 2020 at 19:15)</a>:</h4>
<p>Yes that's what I had in mind as well.</p>



<a name="200836493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200836493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200836493">(Jun 14 2020 at 22:25)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> In the course of working on this, I realized that in the test case <code>asm!("{}", foo);</code>, <code>foo</code> will parse with <code>parse_expr</code>, and won't get rejected until the later <code>expand_preparsed_asm</code>.</p>



<a name="200836540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200836540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200836540">(Jun 14 2020 at 22:26)</a>:</h4>
<p>Which means that the whole "expected <code>in</code>, <code>out</code>, ..." logic won't flag it at that point.</p>



<a name="200836552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200836552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200836552">(Jun 14 2020 at 22:27)</a>:</h4>
<p>I'm trying to figure out if there's some reasonable way to address that without merging the whole <code>expr_to_spanned_string</code> handling into <code>parse_args</code>.</p>



<a name="200836791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200836791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200836791">(Jun 14 2020 at 22:33)</a>:</h4>
<p>(Another option would be to only allow string literals for the second and subsequent template arguments. Not sure if I can get away with that.)</p>



<a name="200839303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200839303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200839303">(Jun 14 2020 at 23:50)</a>:</h4>
<p>Making some progress on that front...</p>



<a name="200839917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200839917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200839917">(Jun 15 2020 at 00:08)</a>:</h4>
<p>OK, I managed to preserve the quality of the diagnostics.</p>



<a name="200852912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200852912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200852912">(Jun 15 2020 at 06:18)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> Managed to find an unrelated bug in the asm prettyprinting code. <code>print_string</code> already takes care of calling <code>escape_debug</code> for you, so <code>impl fmt::Display for InlineAsmTemplatePiece</code> doing so for every character was escaping twice, which resulted in <code>\n</code> becoming <code>\\n</code> and similar.</p>



<a name="200852919"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200852919" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200852919">(Jun 15 2020 at 06:18)</a>:</h4>
<p>I'll fix that in the same series, in a separate commit.</p>



<a name="200855235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200855235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200855235">(Jun 15 2020 at 07:03)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/73364">https://github.com/rust-lang/rust/pull/73364</a></p>



<a name="200856279"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200856279" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200856279">(Jun 15 2020 at 07:19)</a>:</h4>
<p>Currently working on a patch to the RFC.</p>



<a name="200857358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200857358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200857358">(Jun 15 2020 at 07:35)</a>:</h4>
<p><a href="https://github.com/Amanieu/rfcs/pull/1">https://github.com/Amanieu/rfcs/pull/1</a></p>



<a name="200860495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200860495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200860495">(Jun 15 2020 at 08:18)</a>:</h4>
<p>/me is currently looking up the semantics for format string argument numbering...</p>



<a name="200860883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200860883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200860883">(Jun 15 2020 at 08:23)</a>:</h4>
<p>@Amanieu Meanwhile, could you elaborate a little more on the <code>line_spans</code> problem? As far as I can tell, I'm getting the results I'd expect even when I have an <code>asm!</code> with a <code>concat!</code> call for each of its template arguments.</p>



<a name="200861219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200861219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200861219">(Jun 15 2020 at 08:27)</a>:</h4>
<p>I'm also getting exactly the results I'd expect that point directly to the specific template string, when not using <code>concat!</code> macros. (With <code>concat!</code> I get a pointer to the beginning of the <code>concat!</code> invocation, which is the same behavior <code>asm!</code> already seems to have with the first template argument.)</p>



<a name="200861595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200861595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200861595">(Jun 15 2020 at 08:31)</a>:</h4>
<p>Oh, wait. I think I understand now. Writing a new test...</p>



<a name="200862300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200862300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200862300">(Jun 15 2020 at 08:40)</a>:</h4>
<p>OK, I managed to write a test that triggers this.</p>



<a name="200862540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200862540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200862540">(Jun 15 2020 at 08:43)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="w">        </span><span class="n">asm</span><span class="o">!</span><span class="p">(</span><span class="w"></span>
<span class="w">            </span><span class="n">concat</span><span class="o">!</span><span class="p">(</span><span class="w"></span>
<span class="w">                </span><span class="s">&quot;invalid&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;instruction1&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">                </span><span class="s">&quot;invalid&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;instruction2&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">            </span><span class="p">),</span><span class="w"></span>
<span class="w">        </span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="c1">//~^^^^^ ERROR: invalid instruction mnemonic &#39;invalid_instruction1&#39;</span>
<span class="w">        </span><span class="c1">//~^^^^^^ ERROR: invalid instruction mnemonic &#39;invalid_instruction2&#39;</span>

<span class="w">        </span><span class="n">asm</span><span class="o">!</span><span class="p">(</span><span class="w"></span>
<span class="w">            </span><span class="n">concat</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;mov eax&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;, &quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;eax&quot;</span><span class="p">),</span><span class="w"></span>
<span class="w">            </span><span class="n">concat</span><span class="o">!</span><span class="p">(</span><span class="w"></span>
<span class="w">                </span><span class="s">&quot;invalid&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;instruction1&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">                </span><span class="s">&quot;invalid&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;_&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;instruction2&quot;</span><span class="p">,</span><span class="w"></span>
<span class="w">            </span><span class="p">),</span><span class="w"></span>
<span class="w">            </span><span class="n">concat</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;mov eax&quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;, &quot;</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;eax&quot;</span><span class="p">),</span><span class="w"></span>
<span class="w">        </span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="c1">//~^^^^^^ ERROR: invalid instruction mnemonic &#39;invalid_instruction1&#39;</span>
<span class="w">        </span><span class="c1">//~^^^^^^^ ERROR: invalid instruction mnemonic &#39;invalid_instruction2&#39;</span>
</code></pre></div>



<a name="200863253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200863253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200863253">(Jun 15 2020 at 08:51)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> I'm trying to understand how this currently works when provided with a <code>concat!</code> as the first argument.</p>



<a name="200863377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200863377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200863377">(Jun 15 2020 at 08:52)</a>:</h4>
<p>What do you mean?</p>



<a name="200863474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200863474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200863474">(Jun 15 2020 at 08:53)</a>:</h4>
<p>The line spans are basically passed unmodified to LLVM (actually we can only pass an <code>i32</code> so we pass in the start of the span only).</p>



<a name="200863604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200863604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200863604">(Jun 15 2020 at 08:54)</a>:</h4>
<p>When an assembler error occurs, LLVM gives us the <code>i32</code> corresponding to the line on which the error occurred. However if there are fewer <code>i32</code>s than lines then LLVM returns the first <code>i32</code>.</p>



<a name="200863627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200863627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200863627">(Jun 15 2020 at 08:54)</a>:</h4>
<p><span class="user-mention silent" data-user-id="143274">Amanieu</span> <a href="#narrow/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments/near/200863604">said</a>:</p>
<blockquote>
<p>When an assembler error occurs, LLVM gives us the <code>i32</code> corresponding to the line on which the error occurred. However if there are fewer <code>i32</code>s than lines then LLVM returns the first <code>i32</code>.</p>
</blockquote>
<p>Ah, <em>that's</em> what I was missing.</p>



<a name="200863661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200863661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200863661">(Jun 15 2020 at 08:55)</a>:</h4>
<p>And we can't get away with that anymore if there are actually more line spans.</p>



<a name="200863664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200863664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200863664">(Jun 15 2020 at 08:55)</a>:</h4>
<p>Argh.</p>



<a name="200863705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200863705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200863705">(Jun 15 2020 at 08:55)</a>:</h4>
<p>The solution is simple: just duplicate <code>template_sp</code> for every line in the asm.</p>



<a name="200863745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200863745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200863745">(Jun 15 2020 at 08:56)</a>:</h4>
<p>That way the number of spans always matches the number of lines.</p>



<a name="200863766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200863766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200863766">(Jun 15 2020 at 08:56)</a>:</h4>
<p>Does it suffice to simply count the <code>\n</code> characters in a string literal, and assume that we should have one copy of <code>template_sp</code> for each one?</p>



<a name="200863844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200863844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200863844">(Jun 15 2020 at 08:57)</a>:</h4>
<p>That would work. I was thinking of modifying <code>Parser</code> to always generate line spans but you solution might be better.</p>



<a name="200864077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200864077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200864077">(Jun 15 2020 at 08:59)</a>:</h4>
<p>I'm assuming this will all just fall over dead if someone manages to substitute in an operand whose value contains a literal <code>\n</code>?</p>



<a name="200864110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200864110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200864110">(Jun 15 2020 at 08:59)</a>:</h4>
<p>I don't think that's possible.</p>



<a name="200864120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200864120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200864120">(Jun 15 2020 at 09:00)</a>:</h4>
<p>And in any case there's nothing we could do about it.</p>



<a name="200864168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200864168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200864168">(Jun 15 2020 at 09:00)</a>:</h4>
<p>Really weird constant or symbol name? :)</p>



<a name="200864228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200864228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200864228">(Jun 15 2020 at 09:01)</a>:</h4>
<p>Still nothing we can do about it, so let's not worry about it.</p>



<a name="200864252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200864252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200864252">(Jun 15 2020 at 09:01)</a>:</h4>
<p>Alright. Then this should be straightforward enough.</p>



<a name="200864256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200864256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200864256">(Jun 15 2020 at 09:01)</a>:</h4>
<p>It's only diagnostics anyways.</p>



<a name="200864414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200864414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200864414">(Jun 15 2020 at 09:03)</a>:</h4>
<p>I'd still like to get it right. I appreciate you catching the bug.</p>



<a name="200864667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200864667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200864667">(Jun 15 2020 at 09:06)</a>:</h4>
<p>I revised the test to be meaner, covering a few more cases that I want to get right.</p>



<a name="200864826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200864826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200864826">(Jun 15 2020 at 09:08)</a>:</h4>
<p>I remember you mentioning that LLVM re-generates the assembly instructions.</p>



<a name="200864850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200864850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200864850">(Jun 15 2020 at 09:08)</a>:</h4>
<p>(And in particular that indentation doesn't matter.)</p>



<a name="200864884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200864884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200864884">(Jun 15 2020 at 09:09)</a>:</h4>
<p>What happens if you write something like <code>concat!("invalid_instruction1", "\n\n\n\n\n", "invalid_instruction2")</code>?</p>



<a name="200864913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200864913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200864913">(Jun 15 2020 at 09:09)</a>:</h4>
<p>Is the srcloc mapping taking place based on the user's whitespace, or LLVM's?</p>



<a name="200866167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200866167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200866167">(Jun 15 2020 at 09:23)</a>:</h4>
<p>The user's whitespace.</p>



<a name="200866185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200866185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200866185">(Jun 15 2020 at 09:23)</a>:</h4>
<p>Assembler errors happen when LLVM is parsing the asm string.</p>



<a name="200866286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200866286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200866286">(Jun 15 2020 at 09:25)</a>:</h4>
<p>Ah, got it. Thanks!</p>



<a name="200866455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200866455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200866455">(Jun 15 2020 at 09:27)</a>:</h4>
<p>As for the positional argument issue across multiple string literal arguments, I'm trying to figure out if there's some easier way to solve that than to add a "base" argument to the format string parsing machinery.</p>



<a name="200866871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200866871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200866871">(Jun 15 2020 at 09:31)</a>:</h4>
<p>Because something like <code>asm!("{1} {0}", "{}", ...)</code> would need to have that last <code>{}</code> translate to <code>{1}</code>, since it should advance from the <code>{0}</code>.</p>



<a name="200866933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200866933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200866933">(Jun 15 2020 at 09:32)</a>:</h4>
<p>Just carry the argument index over across parser invocations.</p>



<a name="200866939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200866939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200866939">(Jun 15 2020 at 09:32)</a>:</h4>
<p>Hmmm. I'm trying to figure out if...right.</p>



<a name="200866995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200866995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200866995">(Jun 15 2020 at 09:33)</a>:</h4>
<p>It's basically the <code>curarg</code> field of <code>Parser</code>.</p>



<a name="200867034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200867034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200867034">(Jun 15 2020 at 09:33)</a>:</h4>
<p>The simplest thing to do would be to make it <code>pub</code>.</p>



<a name="200867118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200867118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200867118">(Jun 15 2020 at 09:34)</a>:</h4>
<p>/me was thinking about whether it would be possible to just remember the last argument index from the previous iteration, and add that to all the indexes obtained from the next parser.</p>



<a name="200867148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200867148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200867148">(Jun 15 2020 at 09:34)</a>:</h4>
<p>Trying to find a counterexample where that wouldn't work...</p>



<a name="200867211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200867211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200867211">(Jun 15 2020 at 09:35)</a>:</h4>
<p>Oh. Right, that'd be much more complicated.</p>



<a name="200867230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200867230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200867230">(Jun 15 2020 at 09:35)</a>:</h4>
<p>Just initialize <code>curarg</code> in <code>Parser</code> with the value from the previous iteration.</p>



<a name="200867246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200867246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200867246">(Jun 15 2020 at 09:35)</a>:</h4>
<p>Yeah, agreed.</p>



<a name="200867448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200867448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200867448">(Jun 15 2020 at 09:37)</a>:</h4>
<p>Given that <code>Parser</code> seems guaranteed to be lazy (and not do any parsing until you call <code>.next()</code>).</p>



<a name="200867970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200867970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200867970">(Jun 15 2020 at 09:42)</a>:</h4>
<p>Thanks for all the help!</p>



<a name="200867992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200867992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200867992">(Jun 15 2020 at 09:42)</a>:</h4>
<p>This is the first time I've done non-trivial rustc hacking.</p>



<a name="200868037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200868037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200868037">(Jun 15 2020 at 09:43)</a>:</h4>
<p>Implementing inline asm was the same for me!</p>



<a name="200868046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200868046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200868046">(Jun 15 2020 at 09:43)</a>:</h4>
<p>Wow. I'm impressed. :)</p>



<a name="200868732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200868732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200868732">(Jun 15 2020 at 09:52)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> I still think <code>TemplateBoundary</code> should just be replaced with <code>String("\n")</code>.</p>



<a name="200868813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200868813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200868813">(Jun 15 2020 at 09:52)</a>:</h4>
<p>I didn't want to special-case <code>String("\n")</code>, because then if someone passed <code>"\n"</code> as a template string argument, the pretty-printed output wouldn't match the input.</p>



<a name="200868839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200868839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200868839">(Jun 15 2020 at 09:53)</a>:</h4>
<p>The pretty-printed output already doesn't match the input, as I stated in my reply.</p>



<a name="200868869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200868869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200868869">(Jun 15 2020 at 09:53)</a>:</h4>
<p>Didn't see that reply.</p>



<a name="200868940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200868940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200868940">(Jun 15 2020 at 09:54)</a>:</h4>
<p>Github UI fail, it's because you marked it resolved.</p>



<a name="200868949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200868949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200868949">(Jun 15 2020 at 09:54)</a>:</h4>
<p>Yes, that's true, but it still seemed like a useful property, and in particular, preserving that property made it easier for me to catch some bugs in the pretty-printing.</p>



<a name="200868959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200868959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200868959">(Jun 15 2020 at 09:54)</a>:</h4>
<p>Yeah, if something is marked as resolved and someone posts a new comment, it should be un-resolved.</p>



<a name="200869027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869027">(Jun 15 2020 at 09:55)</a>:</h4>
<p>I'm not <em>incredibly</em> opposed to dropping <code>TemplateBoundary</code>, but I have a mild preference. What's the reason for dropping it? Just so that things parsing an <code>InlineAsmTemplatePiece</code> don't have to get updated?</p>



<a name="200869032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869032">(Jun 15 2020 at 09:55)</a>:</h4>
<p>Are there that many of those?</p>



<a name="200869135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869135">(Jun 15 2020 at 09:56)</a>:</h4>
<p>It just feels unnecessary to have this distinction in the AST. The split template is really just sugar for multi-line strings and we should desugar to a single multi-line string.</p>



<a name="200869150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869150">(Jun 15 2020 at 09:57)</a>:</h4>
<p>/me tries an experiment.</p>



<a name="200869174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869174">(Jun 15 2020 at 09:57)</a>:</h4>
<p>I think I might be able to make this work in a way that doesn't need <code>TemplateBoundary</code> and still maintains the property I'd like.</p>



<a name="200869194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869194">(Jun 15 2020 at 09:57)</a>:</h4>
<p>What is this property?</p>



<a name="200869273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869273">(Jun 15 2020 at 09:58)</a>:</h4>
<p>Pretty-printing mostly maintaining the boundaries.</p>



<a name="200869359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869359">(Jun 15 2020 at 09:59)</a>:</h4>
<p>The main use for pretty printing is <code>cargo expand</code> where you want to see what code the compiler is actually going to be processing. I feel that it is more beneficial to see exactly what asm is being passed to the backend, newlines and all.</p>



<a name="200869434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869434">(Jun 15 2020 at 10:00)</a>:</h4>
<p>It's also really useful for the pretty-printing tests, for which it's really nice to see the arguments separately. :)</p>



<a name="200869441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869441">(Jun 15 2020 at 10:00)</a>:</h4>
<p>As long as I have a separate entry in the list that contains <em>only</em> a <code>String("\n")</code>, I can split on those and do the same thing. It won't match if you have <code>"\n"</code> as an argument by itself, but I can live with that to avoid excess complexity.</p>



<a name="200869482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869482">(Jun 15 2020 at 10:01)</a>:</h4>
<p>That feels like a worse solution overall.</p>



<a name="200869516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869516">(Jun 15 2020 at 10:01)</a>:</h4>
<p>It does avoid having to change backends. And it pretty-prints in a format <em>equivalent</em> to what you put in.</p>



<a name="200869593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869593">(Jun 15 2020 at 10:02)</a>:</h4>
<p>What would be the disadvantage of this approach?</p>



<a name="200869627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869627">(Jun 15 2020 at 10:02)</a>:</h4>
<p>/me is absolutely open to dropping it, and just wants to understand what the concern is.</p>



<a name="200869662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869662">(Jun 15 2020 at 10:03)</a>:</h4>
<p>/me doesn't want to have to debug massive concatenated assembly strings if he doesn't have to.</p>



<a name="200869695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869695">(Jun 15 2020 at 10:03)</a>:</h4>
<p>But you don't use pretty-printing for debugging?</p>



<a name="200869763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869763">(Jun 15 2020 at 10:04)</a>:</h4>
<p>My main concern is that I want the concept of split template strings to be syntax sugar in the macro itself. It should not be reflected in the AST.</p>



<a name="200869830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869830">(Jun 15 2020 at 10:05)</a>:</h4>
<p>I absolutely would use <code>cargo expand</code> or equivalent if using macro-generated assembly.</p>



<a name="200869835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869835">(Jun 15 2020 at 10:05)</a>:</h4>
<p>(Which is not uncommon.)</p>



<a name="200869850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869850">(Jun 15 2020 at 10:05)</a>:</h4>
<p>And it was useful when debugging <code>asm!</code> itself.</p>



<a name="200869865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869865">(Jun 15 2020 at 10:05)</a>:</h4>
<p>Then do the splitting in pretty-printing by splitting on all "\n".</p>



<a name="200869872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869872">(Jun 15 2020 at 10:06)</a>:</h4>
<p>Even those embedded in <code>String()</code></p>



<a name="200869937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869937">(Jun 15 2020 at 10:06)</a>:</h4>
<p>Hmmm. Definitely not opposed to doing that. :)</p>



<a name="200869966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200869966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200869966">(Jun 15 2020 at 10:06)</a>:</h4>
<p>You're wanting there to be a canonical form of the expansion that doesn't care where you put the format string boundaries?</p>



<a name="200870000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870000">(Jun 15 2020 at 10:07)</a>:</h4>
<p>Sure.</p>



<a name="200870011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870011">(Jun 15 2020 at 10:07)</a>:</h4>
<p>Alright. Will do.</p>



<a name="200870033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870033">(Jun 15 2020 at 10:07)</a>:</h4>
<p><code>asm!("a", "b")</code> and <code>asm!("a\nb")</code> should both expand to the same thing.</p>



<a name="200870456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870456">(Jun 15 2020 at 10:13)</a>:</h4>
<p><span class="user-mention" data-user-id="239881">@Josh Triplett</span> Can you try <code>asm!("mov eax, eax\n", "invalid_instruction")</code> to see if the error points to the correct location?</p>



<a name="200870466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870466">(Jun 15 2020 at 10:13)</a>:</h4>
<p>All on one line like that?</p>



<a name="200870474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870474">(Jun 15 2020 at 10:13)</a>:</h4>
<p>Sure.</p>



<a name="200870487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870487">(Jun 15 2020 at 10:13)</a>:</h4>
<p>The error span should point to the start of <code>invalid_instruction</code>.</p>



<a name="200870494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870494">(Jun 15 2020 at 10:13)</a>:</h4>
<p><em>nod</em></p>



<a name="200870501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870501">(Jun 15 2020 at 10:13)</a>:</h4>
<p>(It doesn't matter if it's all on the same line or not)</p>



<a name="200870618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870618">(Jun 15 2020 at 10:15)</a>:</h4>
<p>OK, test case added. Will test after I've finished working on the pretty-printing.</p>



<a name="200870716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870716">(Jun 15 2020 at 10:16)</a>:</h4>
<p>I think the parser will only generate 1 line span instead of 2 for the first string, which will cause issues.</p>



<a name="200870801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870801">(Jun 15 2020 at 10:17)</a>:</h4>
<p>Hmmm.</p>



<a name="200870881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870881">(Jun 15 2020 at 10:18)</a>:</h4>
<p>Is that because the <code>\n</code> is at the end of that string, or because the string is all on one Rust source line?</p>



<a name="200870906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870906">(Jun 15 2020 at 10:18)</a>:</h4>
<p>Because the \n is at the end of the string</p>



<a name="200870939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870939">(Jun 15 2020 at 10:19)</a>:</h4>
<p>It's because of this line in the parser: <code>if self.is_literal &amp;&amp; self.cur_line_start != self.input.len() {</code></p>



<a name="200870941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200870941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200870941">(Jun 15 2020 at 10:19)</a>:</h4>
<p>So <code>mov eax, eax\nmov eax, eax</code> would be fine?</p>



<a name="200871034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871034">(Jun 15 2020 at 10:20)</a>:</h4>
<p>I see.</p>



<a name="200871053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871053">(Jun 15 2020 at 10:20)</a>:</h4>
<p>Is there such a thing as a span where <code>lo==hi</code>?</p>



<a name="200871064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871064">(Jun 15 2020 at 10:20)</a>:</h4>
<p>Or does a span <em>have</em> to include at least one character?</p>



<a name="200871080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871080">(Jun 15 2020 at 10:20)</a>:</h4>
<p>If the former, then that seems easy enough to fix by adding another line_span at the end of the string.</p>



<a name="200871101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871101">(Jun 15 2020 at 10:21)</a>:</h4>
<p>Yes zero-length spans are perfectly valid</p>



<a name="200871130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871130">(Jun 15 2020 at 10:21)</a>:</h4>
<p>I think just removing <code>self.cur_line_start != self.input.len()</code> from the condition should be enough.</p>



<a name="200871200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871200">(Jun 15 2020 at 10:22)</a>:</h4>
<p>I'll try that.</p>



<a name="200871208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871208">(Jun 15 2020 at 10:22)</a>:</h4>
<p>It has the unfortunate side-effect of adding a trailing line span every time the iterator returns <code>None</code>, but that shouldn't be a problem in practice.</p>



<a name="200871243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871243">(Jun 15 2020 at 10:22)</a>:</h4>
<p>Maybe also check that the last <code>line_span</code> doesn't cover to the end of the string.</p>



<a name="200871280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871280">(Jun 15 2020 at 10:23)</a>:</h4>
<p><span class="user-mention silent" data-user-id="143274">Amanieu</span> <a href="#narrow/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments/near/200871208">said</a>:</p>
<blockquote>
<p>It has the unfortunate side-effect of adding a trailing line span every time the iterator returns <code>None</code>, but that shouldn't be a problem in practice.</p>
</blockquote>
<p>Would <code>.fuse()</code> solve that problem?</p>



<a name="200871355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871355">(Jun 15 2020 at 10:24)</a>:</h4>
<p>Yes, but realistically we don't care since we don't poke the iterator after it's done.</p>



<a name="200871361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871361">(Jun 15 2020 at 10:24)</a>:</h4>
<p>Oh, wait, I see what you're proposing.</p>



<a name="200871398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871398">(Jun 15 2020 at 10:25)</a>:</h4>
<p>Would it suffice to check that the last line_span isn't identical to the one we're about to push?</p>



<a name="200871423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871423">(Jun 15 2020 at 10:25)</a>:</h4>
<p>That would work.</p>



<a name="200871556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871556">(Jun 15 2020 at 10:26)</a>:</h4>
<p>Would this change change the behavior of parsing <code>""</code>?</p>



<a name="200871602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871602">(Jun 15 2020 at 10:27)</a>:</h4>
<p>We would just generate 1 line span for it instead of 0.</p>



<a name="200871629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871629">(Jun 15 2020 at 10:27)</a>:</h4>
<p>But line spans are only used for diagnostics, so there's no functional change.</p>



<a name="200871666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200871666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200871666">(Jun 15 2020 at 10:28)</a>:</h4>
<p><span class="user-mention silent" data-user-id="143274">Amanieu</span> <a href="#narrow/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments/near/200871602">said</a>:</p>
<blockquote>
<p>We would just generate 1 line span for it instead of 0.</p>
</blockquote>
<p>Right. Which is fine. Without that, we were using the macro case of "add the whole <code>template_sp</code>" for that case.</p>



<a name="200872520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200872520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200872520">(Jun 15 2020 at 10:37)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> I just realized that in order to implement a canonical expansion that doesn't care where the boundaries are, I'd have to also concatenate the strings <em>before</em> splitting them. That's seeming like more work (memory-wise) than the expander should be doing. I'll just go with the one-big-string approach.</p>



<a name="200872646"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200872646" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200872646">(Jun 15 2020 at 10:38)</a>:</h4>
<p>Rebuilding now. This may take a while, since I changed the AST, which means a rebuild of <code>rustc_middle</code>.</p>



<a name="200873084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200873084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200873084">(Jun 15 2020 at 10:45)</a>:</h4>
<p>By the way this is the command-line I use to run only the asm tests: <code>./x.py test --stage 1 src/test/ui --test-args asm --bless</code></p>



<a name="200874043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200874043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200874043">(Jun 15 2020 at 10:57)</a>:</h4>
<p>I've been using this, because I want some of the tests outside of <code>ui</code> as well: <code>./x.py test -i --stage 1 src/test/assembly/ src/test/codegen/asm-options.rs src/test/incremental/issue-72386.rs src/test/ui/asm/ src/test/ui/consts/miri_unleashed/inline_asm.rs src/test/ui/feature-gates/feature-gate-asm.rs src/test/ui/feature-gates/feature-gate-asm2.rs src/test/ui/macros/macro-expanded-include/foo/mod.rs src/test/ui/macros/macros-nonfatal-errors.rs src/test/pretty/asm.rs</code></p>



<a name="200874536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200874536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200874536">(Jun 15 2020 at 11:03)</a>:</h4>
<p><span class="user-mention" data-user-id="143274">@Amanieu</span> As you predicted, removing <code>self.cur_line_start != self.input.len()</code> completely fixed the issue with string literals that have <code>\n</code> at the end.</p>



<a name="200874740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200874740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200874740">(Jun 15 2020 at 11:05)</a>:</h4>
<p>PR pushed.</p>



<a name="200875065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200875065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200875065">(Jun 15 2020 at 11:09)</a>:</h4>
<p>Resolving the two new comments you made...</p>



<a name="200875284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200875284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200875284">(Jun 15 2020 at 11:12)</a>:</h4>
<p>Done.</p>



<a name="200944713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/216763-project-inline-asm/topic/multiple%20template%20string%20arguments/near/200944713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/216763-project-inline-asm/topic/multiple.20template.20string.20arguments.html#200944713">(Jun 15 2020 at 20:57)</a>:</h4>
<p>OK, I <em>think</em> I've incorporated all of your feedback, and the current version is passing tests. Any further thoughts?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>